#include<iostream>
#include<algorithm>
using namespace std;
bool cmp(int a,int b)
{
	return a > b;
}
int main()
{
	int num, time;
	int a[1001], b[1001];
	cin >> num >> time;
	for (int i = 0;i < num;i++)
	{
		cin >> a[i];
	}
	for (int j = 0;j < num;j++)
	{
		cin >> b[j];
	}
	sort(a, a + num);
	sort(b, b + num, cmp);
	int sum=0;
	for (int k = 0;k < num;k++)
	{
		int flag = a[k] + b[k] - time;
		if (flag> 0)
		{
			sum += flag;
		}
	}
	cout << sum;
	return 0;
}